using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace SilverSea.Video.Tools
{
	public class MotionRegionsForm : Form
	{
		private IContainer icontainer_0;
		private DefineRegionsControl defineRegionsControl;
		private ToolStrip toolStrip;
		private Button okButton;
		private Button cancelButton;
		private ToolStripButton rectangleButton;
		private ToolStripSeparator toolStripSeparator1;
		private ToolStripButton clearButton;
		public System.Drawing.Bitmap VideoFrame
		{
			set
			{
				this.defineRegionsControl.BackgroundImage = value;
			}
		}
		public System.Drawing.Rectangle[] MotionRectangles
		{
			get
			{
				return this.defineRegionsControl.Rectangles;
			}
			set
			{
				this.defineRegionsControl.Rectangles = value;
			}
		}
		public MotionRegionsForm()
		{
			this.InitializeComponent();
			this.defineRegionsControl.OnNewRectangle += new NewRectangleHandler(this.method_0);
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.icontainer_0 != null)
			{
				this.icontainer_0.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MotionRegionsForm));
            this.toolStrip = new System.Windows.Forms.ToolStrip();
            this.rectangleButton = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.clearButton = new System.Windows.Forms.ToolStripButton();
            this.okButton = new System.Windows.Forms.Button();
            this.cancelButton = new System.Windows.Forms.Button();
            this.defineRegionsControl = new SilverSea.Video.Tools.DefineRegionsControl();
            this.toolStrip.SuspendLayout();
            this.SuspendLayout();
            // 
            // toolStrip
            // 
            this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.rectangleButton,
            this.toolStripSeparator1,
            this.clearButton});
            resources.ApplyResources(this.toolStrip, "toolStrip");
            this.toolStrip.Name = "toolStrip";
            // 
            // rectangleButton
            // 
            this.rectangleButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            resources.ApplyResources(this.rectangleButton, "rectangleButton");
            this.rectangleButton.Name = "rectangleButton";
            this.rectangleButton.Click += new System.EventHandler(this.rectangleButton_Click);
            // 
            // toolStripSeparator1
            // 
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1");
            // 
            // clearButton
            // 
            this.clearButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            resources.ApplyResources(this.clearButton, "clearButton");
            this.clearButton.Name = "clearButton";
            this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
            // 
            // okButton
            // 
            resources.ApplyResources(this.okButton, "okButton");
            this.okButton.Name = "okButton";
            this.okButton.UseVisualStyleBackColor = true;
            // 
            // cancelButton
            // 
            resources.ApplyResources(this.cancelButton, "cancelButton");
            this.cancelButton.Name = "cancelButton";
            this.cancelButton.UseVisualStyleBackColor = true;
            // 
            // defineRegionsControl
            // 
            this.defineRegionsControl.BackgroundImage = null;
            this.defineRegionsControl.Cursor = System.Windows.Forms.Cursors.Default;
            this.defineRegionsControl.DrawingMode = SilverSea.Video.Tools.DrawingMode.None;
            resources.ApplyResources(this.defineRegionsControl, "defineRegionsControl");
            this.defineRegionsControl.Name = "defineRegionsControl";
            this.defineRegionsControl.Rectangles = new System.Drawing.Rectangle[0];
            // 
            // MotionRegionsForm
            // 
            resources.ApplyResources(this, "$this");
            this.Controls.Add(this.cancelButton);
            this.Controls.Add(this.okButton);
            this.Controls.Add(this.toolStrip);
            this.Controls.Add(this.defineRegionsControl);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "MotionRegionsForm";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.toolStrip.ResumeLayout(false);
            this.toolStrip.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		protected override void OnLoad(EventArgs e)
		{
			if (this.defineRegionsControl.BackgroundImage != null)
			{
				int width = this.defineRegionsControl.BackgroundImage.Width;
				int height = this.defineRegionsControl.BackgroundImage.Height;
				this.defineRegionsControl.Size = new System.Drawing.Size(width + 2, height + 2);
				base.Size = new System.Drawing.Size(width + 2 + 26, height + 2 + 118);
			}
			base.OnLoad(e);
		}
		private void rectangleButton_Click(object sender, EventArgs e)
		{
			DrawingMode drawingMode = this.defineRegionsControl.DrawingMode;
			drawingMode = ((drawingMode == DrawingMode.Rectangular) ? DrawingMode.None : DrawingMode.Rectangular);
			this.defineRegionsControl.DrawingMode = drawingMode;
			this.rectangleButton.Checked = (drawingMode == DrawingMode.Rectangular);
		}
		private void method_0(object object_0, System.Drawing.Rectangle rectangle_0)
		{
			this.rectangleButton.Checked = false;
		}
		private void clearButton_Click(object sender, EventArgs e)
		{
			this.defineRegionsControl.RemoveAllRegions();
		}
	}
}
